const config = require('./config');
const SolChain = require("./solChain");

const {PublicKey, GetVersion} = require('@solana/web3.js');
const t = async ()=> {
    let solChain = new SolChain(config.devNodeUrl2);
    //let balance = await solChain.getBalance(new PublicKey(config.account1.address));
    //console.log('balance: ', balance);

    let lastHeight = await solChain.getBlockHeight();
    console.log('height: ', lastHeight);
    let block = await solChain.getBlock(lastHeight);
    console.log('block: ', block);

    let transactions = block.transactions;
    for(let i = 0; i < transactions.length ; i++ ) {
        console.log('transaction: ', transactions[i]);
    }
    console.log("transaction[0]: ", transactions[0]);
    console.log('transaction', transactions[0].meta);
    console.log('transaction', transactions[0].transaction);

    //console.log('instructions: ', transactions[0].transaction.message.instructions);

    //let signgature = "4bRosJVxfLpL3w6ywKgxpdFeeig1A3io4nBnYuKithb1UDnLaYzCijUE4H594APS8noEY8ziTC26wpSdzx5XdMP4";

    //let tx = await solChain.getTransaction(signgature);
    //console.log('tx: ', tx);


}

t();